package org.icosagon.core.character;

import java.util.Vector;
import org.icosagon.core.character.traits.Ability;

/**
 *
 * @author Daniel Owens
 */
public class Race extends AbstractBase {
    private Vector<Ability> abilities = new Vector<Ability>();
    
    public void setAbilityModifier(Ability ability, int value) {
        for(Ability temp : this.abilities) {
            if(temp.getName().toLowerCase().equals(ability.getName().toLowerCase())) {
                temp.setValue(value);
                return;
            }
        }
        ability.setValue(value);
        this.abilities.add(ability);
    }

    /**
     * Returns the value of the ability type passed to this method.
     * @param ability The comparative object type.
     * @return The ability score of the passed ability type.
     */
    public int getAbilityModifier(Ability ability) {
        for(Ability temp : this.abilities)
            if(temp.getName().equals(ability.getName()))
                return temp.getValue();
        return -1;
    }

    /**
     *  Returns the value of the named ability type.
     * @param ability The name of the ability value you want to retrieve.
     * @return The ability score of the passed name.
     */
    public int getAbilityModifier(String ability) {
        for(Ability temp : this.abilities)
            if(temp.getName().toLowerCase().equals(ability.toLowerCase()))
                return temp.getValue();
        return -1;
    }

    public Vector<Ability> getAbilitiesModifiers() {
        return this.abilities;
    }
}